|
sgdk
|
Entry point unit / Interrupt callback / System. More...
Go to the source code of this file.
Defines | |
| #define | PROCESS_PALETTE_FADING (1 << 0) |
| #define | PROCESS_BITMAP_TASK (1 << 1) |
| #define | PROCESS_TILECACHE_TASK (1 << 2) |
| #define | PROCESS_SPRITEENGINE_TASK (1 << 3) |
Functions | |
| void | SYS_assertReset () |
| Assert reset. | |
| void | SYS_reset () |
| Soft reset. | |
| u16 | SYS_getInterruptMaskLevel () |
| Return current interrupt mask level. | |
| void | SYS_setInterruptMaskLevel (u16 value) |
| Set interrupt mask level. | |
| u16 | SYS_getAndSetInterruptMaskLevel (u16 value) |
| Set the interrupt mask level to given value and return previous level. | |
| void | SYS_disableInts () |
| Disable interrupts (Vertical, Horizontal and External). | |
| void | SYS_enableInts () |
| Reenable interrupts (Vertical, Horizontal and External). | |
| void | SYS_setVIntCallback (_voidCallback *CB) |
| Set Vertical interrupt callback method. | |
| void | SYS_setHIntCallback (_voidCallback *CB) |
| Set Horizontal interrupt callback method. | |
| void | SYS_setExtIntCallback (_voidCallback *CB) |
| Set External interrupt callback method. | |
| u16 | SYS_isInVIntCallback () |
| Return != 0 if we are in the V-Int callback method. | |
| u16 | SYS_isInHIntCallback () |
| Return != 0 if we are in the H-Int callback method. | |
| u16 | SYS_isInExtIntCallback () |
| Return != 0 if we are in the Ext-Int callback method. | |
| u16 | SYS_isInInterrupt () |
| Return != 0 if we are in an interrupt callback method (Vertical, Horizontal or External) | |
| void | SYS_die (char *err) |
| Die with the specified error message. Program execution is interrupted. | |
Variables | |
| u32 | vtimer |
| u32 | htimer |
| _voidCallback * | busErrorCB |
| Bus error interrupt callback. | |
| _voidCallback * | addressErrorCB |
| Address error interrupt callback. | |
| _voidCallback * | illegalInstCB |
| Illegal instruction exception callback. | |
| _voidCallback * | zeroDivideCB |
| Division by zero exception callback. | |
| _voidCallback * | chkInstCB |
| CHK instruction interrupt callback. | |
| _voidCallback * | trapvInstCB |
| TRAPV instruction interrupt callback. | |
| _voidCallback * | privilegeViolationCB |
| Privilege violation exception callback. | |
| _voidCallback * | traceCB |
| Trace interrupt callback. | |
| _voidCallback * | line1x1xCB |
| Line 1x1x exception callback. | |
| _voidCallback * | errorExceptionCB |
| Error exception callback. | |
| _voidCallback * | intCB |
| Level interrupt callback. | |
| _voidCallback * | internalVIntCB |
| Internal Vertical interrupt callback. | |
| _voidCallback * | internalHIntCB |
| Internal Horizontal interrupt callback. | |
| _voidCallback * | internalExtIntCB |
| Internal External interrupt callback. | |
Entry point unit / Interrupt callback / System.
This unit contains SGDK initialization / reset methods, IRQ callbacks and others system stuff.
| void SYS_assertReset | ( | ) |
Assert reset.
Assert reset pin on the 68000 CPU. This is needed to reset some attached hardware.
| void SYS_die | ( | char * | err | ) |
Die with the specified error message.
Program execution is interrupted.
This actually display an error message and program ends execution.
| void SYS_disableInts | ( | ) |
Disable interrupts (Vertical, Horizontal and External).
This method is used to temporary disable interrupt (to protect some VDP accesses for instance) and should always be followed by SYS_enableInts().
Be careful, this method can't be used if you are currently processing an interrupt !
| void SYS_enableInts | ( | ) |
Reenable interrupts (Vertical, Horizontal and External).
This method is used to reenable interrupt after a call to SYS_disableInts().
Has no effect if called without a prior SYS_disableInts() call.
| u16 SYS_getAndSetInterruptMaskLevel | ( | u16 | value | ) |
Set the interrupt mask level to given value and return previous level.
You can disable interrupt depending their level.
Interrupt with level <= interrupt mask level are ignored.
We have 3 different interrupts:
Vertical interrupt (V-INT): level 6 Horizontal interrupt (H-INT): level 4 External interrupt (EX-INT): level 2 Vertical interrupt has the highest level (and so priority) where external interrupt has lowest one.
For instance to disable Vertical interrupt just use SYS_setInterruptMaskLevel(6).
| u16 SYS_getInterruptMaskLevel | ( | ) |
Return current interrupt mask level.
See SYS_setInterruptMaskLevel() for more informations about interrupt mask level.
| u16 SYS_isInExtIntCallback | ( | ) |
Return != 0 if we are in the Ext-Int callback method.
This method tests if we are currently processing an External interrupt.
| u16 SYS_isInHIntCallback | ( | ) |
Return != 0 if we are in the H-Int callback method.
This method tests if we are currently processing a Horizontal retrace interrupt.
| u16 SYS_isInInterrupt | ( | ) |
Return != 0 if we are in an interrupt callback method (Vertical, Horizontal or External)
This method tests if we are currently processing an interrupt.
| u16 SYS_isInVIntCallback | ( | ) |
Return != 0 if we are in the V-Int callback method.
This method tests if we are currently processing a Vertical retrace interrupt.
| void SYS_reset | ( | ) |
Soft reset.
Software reset
| void SYS_setExtIntCallback | ( | _voidCallback * | CB | ) |
Set External interrupt callback method.
| CB | Pointer to the method to call on External Interrupt. You can remove current callback by passing a null pointer here. |
External interrupt happen on Light Gun trigger (HVCounter is locked).
| void SYS_setHIntCallback | ( | _voidCallback * | CB | ) |
Set Horizontal interrupt callback method.
| CB | Pointer to the method to call on Horizontal Interrupt. You can remove current callback by passing a null pointer here. |
Horizontal interrupt happen at the end of scanline display period right before Horizontal blank.
This period is usually used to do mid frame changes (palette, scrolling or others raster effect)
| void SYS_setInterruptMaskLevel | ( | u16 | value | ) |
Set interrupt mask level.
You can disable interrupt depending their level.
Interrupt with level <= interrupt mask level are ignored.
We have 3 different interrupts:
Vertical interrupt (V-INT): level 6 Horizontal interrupt (H-INT): level 4 External interrupt (EX-INT): level 2 Vertical interrupt has the highest level (and so priority) where external interrupt has lowest one.
For instance to disable Vertical interrupt just use SYS_setInterruptMaskLevel(6).
| void SYS_setVIntCallback | ( | _voidCallback * | CB | ) |
Set Vertical interrupt callback method.
| CB | Pointer to the method to call on Vertical Interrupt. You can remove current callback by passing a null pointer here. |
Vertical interrupt happen at the end of display period right before vertical blank.
This period is usually used to prepare next frame data (refresh sprites, scrolling ...)
| _voidCallback* addressErrorCB |
Address error interrupt callback.
You can modify it to use your own callback (for debug purpose).
| _voidCallback* busErrorCB |
Bus error interrupt callback.
You can modify it to use your own callback (for debug purpose).
| _voidCallback* chkInstCB |
CHK instruction interrupt callback.
You can modify it to use your own callback (for debug purpose).
| _voidCallback* errorExceptionCB |
Error exception callback.
You can modify it to use your own callback (for debug purpose).
| _voidCallback* illegalInstCB |
Illegal instruction exception callback.
You can modify it to use your own callback (for debug purpose).
| _voidCallback* intCB |
Level interrupt callback.
You can modify it to use your own callback.
| _voidCallback* internalExtIntCB |
Internal External interrupt callback.
You can modify it to use your own callback.
Be careful: by doing that you disable SGDK default Ext-Int code and related features !
You should use it only for very low level process and if you don't care about SGDK facilities.
In all others cases you would use the SYS_setExtIntCallback() method.
| _voidCallback* internalHIntCB |
Internal Horizontal interrupt callback.
You can modify it to use your own callback.
Be careful: by doing that you disable SGDK default H-Int code and related features !
You should use it only for very low level process and if you don't care about SGDK facilities.
In all others cases you would use the SYS_setHIntCallback() method.
| _voidCallback* internalVIntCB |
Internal Vertical interrupt callback.
You can modify it to use your own callback.
Be careful: by doing that you disable SGDK default V-Int code and related features !
You should use it only for very low level process and if you don't care about SGDK facilities.
In all others cases you would use the SYS_setVIntCallback() method.
| _voidCallback* line1x1xCB |
Line 1x1x exception callback.
You can modify it to use your own callback (for debug purpose).
| _voidCallback* privilegeViolationCB |
Privilege violation exception callback.
You can modify it to use your own callback (for debug purpose).
| _voidCallback* traceCB |
Trace interrupt callback.
You can modify it to use your own callback (for debug purpose).
| _voidCallback* trapvInstCB |
TRAPV instruction interrupt callback.
You can modify it to use your own callback (for debug purpose).
| _voidCallback* zeroDivideCB |
Division by zero exception callback.
You can modify it to use your own callback (for debug purpose).